#include <cs50.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main(void) {
	srand((unsigned) time(NULL));

	int num = rand() % 100;
	int tries = 0;
	int max_try = 7;

	//printf("Random number: %d\n", num);
	while (true) {
		if (tries > max_try) {
			printf("没机会了！\n");
			break;
		}

		printf("请输入数字：");
		int tmp = GetInt();
		if (tmp == num) {
			printf("猜对了!\n");
			break;
		} else if (tmp > num) {
			printf("猜大了！\n");
		} else {
			printf("猜小了！\n");
		}

		tries++;

	}
}
